#ifndef NR_DATA_H
#define NR_DATA_H

#include "nr_std.h"
#include "nr_object.h"

class nr_data : public nr_object
{
public:
    
    static nr_data* create();
    static void destroy(nr_data* data);

    nr_device_id_t& device_id() { return m_device_id; }
    
    QDateTime& time() { return m_time; } 

    QVariantHash& args() { return m_args; }
    
    virtual void serialize(QDataStream& data_stream);
    virtual void deserialize(QDataStream& data_stream);

    void add_ref();
    void dec_ref();
    
protected:
    nr_data();
    ~nr_data();

    nr_device_id_t m_device_id;
    QDateTime m_time;

    QVariantHash m_args;
    QAtomicInt m_ref_count;
    
    // void *m_buf;
    // quint32 m_buf_len;
};

class nr_event : public nr_object
{
public:
    nr_event();
    ~nr_event();
    
    static nr_event* create();
    static void destroy(nr_event* evt);

    QDateTime& time() { return m_time; } 

    nr_device_id_t& device_id() { return m_device_id; }
    nr_event_category_t& category() { return m_category; }
    nr_id_t& event_id() { return m_event_id; } 
    QString& description() { return m_description; }
    QString& meta_data() { return m_meta_data; };

    void add_ref();
    void dec_ref();
    
private:
    nr_device_id_t m_device_id;
    nr_event_category_t m_category;
    nr_id_t m_event_id;
    QString m_description; 
    QString m_meta_data;
    QDateTime m_time;
};

#endif // NR_DATA_H
